package javaBase.nowcoder.HJ17_A_坐标移动;

import java.io.*;

import java.io.InputStreamReader;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String str = bufferedReader.readLine();
        bufferedReader.close();
        String strs[] = str.split(";");
        int x = 0, y = 0;
        Pattern p = Pattern.compile("(W|A|S|D)\\d{1,}");

        for (int i = 0; i < strs.length; i++) {
            String s = strs[i];
            if (p.matcher(s).matches()) {
                switch (s.charAt(0)) {
                    case 'A':
                        x -= Integer.parseInt(s.substring(1));
                        break;
                    case 'D':
                        x += Integer.parseInt(s.substring(1));
                        break;
                    case 'W':
                        y += Integer.parseInt(s.substring(1));
                        break;
                    case 'S':
                        y -= Integer.parseInt(s.substring(1));
                        break;
                    default:
                        break;
                }
            }
        }
        System.out.println(x + "," + y);
    }
}
